/* ====================================== 异步加载有状态组件  ====================================== */
import React, { Component } from 'react'
// ===================================================================== 
const Index = importComponent => {
	
	return class extends Component {
		
		state = { Component: null }
		
		async componentDidMount() {
			
			// importComponent().then(f => this.setState({ Component: f.default } ) )
			
			const { default: Component } = await importComponent(); 
			
			this.setState({ Component } )
		}
		
		render() {
			const { Component } = this.state
			return Component ? <Component {...this.props}/> : null
		}
	}
}

export default Index